package net.peelmeagrape.hibernate;

import net.peelmeagrape.hibernate.xmlgen.XmlAttribute;
import net.peelmeagrape.hibernate.xmlgen.XmlElement;

import static java.lang.annotation.ElementType.*;
import java.lang.annotation.Retention;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Target;

/**
 * Used so that a class can be referenced using an alias in hibernate queries.
 * Suppose your application has two persistent classes with the same name, and
 * you don't want to specify the fully qualified (package) name in Hibernate queries.
 */
@Target({METHOD,FIELD,CONSTRUCTOR,TYPE,PACKAGE})
@Retention(RUNTIME)
@XmlElement(name="import", parent="hibernate-mapping")
public @interface Import
{
    @XmlAttribute("class") Class value();
    @XmlAttribute String rename() default "";
}
